// src/api/productionOrderApi.js
import http from '../util/request.js';

export default {
    // 获取生产订单列表（支持模糊查询）
    list: (params = {}) => http({
        url: '/api/production_order',
        method: 'get',
        params,
    }),

    // 分页获取生产订单列表
    page: (page, params = {}) => http({
        url: '/api/production_order/page',
        method: 'get',
        params: { ...params, ...page },
    }),

    // 添加生产订单
    add: (obj) => http({
        url: '/api/production_order',
        method: 'post',
        data: obj,
        headers: { 'Content-Type': 'application/json' },
    }),

    // 编辑生产订单
    edit: (obj) => http({
        url: `/api/production_order/${obj.id}`,
        method: 'put',
        data: obj,
        headers: { 'Content-Type': 'application/json' },
    }),

    // 删除生产订单
    del: (id) => http({
        url: `/api/production_order/${id}`,
        method: 'delete',
    }),

    // 获取单个生产订单
    one: (id) => http({
        url: `/api/production_order/${id}`,
        method: 'get',
    }),
};